home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-14 | 2.0 KB | 92 lines | [TEXT/MPS ] |
- /* _________________________________________________________________________________________________________ //
- Copyright © 1992 Apple Computer, Inc. All rights reserved.
- Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
- Originator: Kent Sandvik
- Date: 9/20/92
- Revision comments are at the end of this file.
- ---
- TKeyMap is a KeyMap utility class.
- TKeyMap.cp contains the member functions for the TKeyMap class.
- _________________________________________________________________________________________________________ */
-
- #ifndef _KEYMAP_
- #include "KeyMap.h"
- #endif
-
-
- // _________________________________________________________________________________________________________ //
- // TProcess class member function implementations
-
- // CONSTRUCTORS & DESTRUCTORS
-
- #pragma segment KeyMap
- TKeyMap::TKeyMap()
- // Main constructor, empty for the time being.
- {
- }
-
-
- #pragma segment KeyMap
- TKeyMap::~TKeyMap()
- // Main destructor, empty for the time being.
- {
- }
-
-
- // MAIN INTERFACES
- #pragma segment KeyMap
- Boolean TKeyMap::OptionKeyDown()
- // Return true if option key is down.
- {
- ::GetKeys(fKeyMap); // get info
- if (fKeyMap[1] & 4)
- return true;
- else
- return false;
- }
-
- #pragma segment KeyMap
- Boolean TKeyMap::CommandKeyDown()
- // Return true if command (Apple) key is down.
- {
- ::GetKeys(fKeyMap); // get info
- if (fKeyMap[1] & 0x8000)
- return true;
- else
- return false;
- }
-
-
- #pragma segment KeyMap
- Boolean TKeyMap::ShiftKeyDown()
- // Return true if shift key is down.
- {
- ::GetKeys(fKeyMap); // get info
- if (fKeyMap[1] & 1)
- return true;
- else
- return false;
- }
-
-
- // Fast macro for testing key codes.
- #define KeyCode(x,y) (BitTst(&(x), (y) ^ 0x07))
-
-
- #pragma segment KeyMap
- Boolean TKeyMap::IsKeyDown(unsigned short key)
- // Return true if key defined is down.
- {
- ::GetKeys(fKeyMap); // get info
- return (KeyCode(fKeyMap, key));
- }
-
-
- // _________________________________________________________________________________________________________ //
-
-
- /* Change History (most recent last):
- No Init. Date Comment
- 1 khs 9/20/92 New file
- */
-